/*******************************************************************************
 * @project: CDMS
 * @package: com.esoon.cdms.util
 * @file: JaxbUtil.java
 * @author: zhangpei
 * @created: 2017-2-13
 * @purpose:
 * 
 * @version: 1.0
 * 
 * Revision History at the end of file.
 * 
 * Copyright 2017 AcconSys All rights reserved.
 ******************************************************************************/

/**
 * 
 */
package com.esoon.cdms.util;

import java.io.StringReader;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;

/**
 * @author Administrator
 *
 */
public class JaxbUtil {

	public static <T> Object xml2Java(Class<T> entityClass, String xmlString) {
		Object object = null;
		try {
			JAXBContext act = JAXBContext.newInstance(entityClass);
			Unmarshaller unMarshaller = act.createUnmarshaller();
			object = unMarshaller.unmarshal(new StringReader(xmlString));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return object;
	}
}


/*******************************************************************************
 * <B>Revision History</B><BR>
 * [type 'revision' and press Alt + / to insert revision block]<BR>
 * 
 * 
 * 
 * Copyright 2017 AcconSys All rights reserved.
 ******************************************************************************/